Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext

RE: ODBC Connection to Oracle
~Bella Deswevitchlen 15.Oct.03 07:30 PM a Web browser
Notes Client 6.0.1 CF1 Windows 2000


I inherited an app that connects to DB2 on an AS/400 (hence using *Local as the Data source). We have lots of code in the script libraries, but we always have the InitCon sub below in the agents. I haven't questioned why. The Connect function is in in the script library, and username and password are in the Declarations of the script library. Sorry about the wrapping.

IN THE AGENT:
(Declarations)
'Dimension as private to keep objects with this script
Private Con As ODBCConnection
Private Qry As ODBCQuery
Private Res As ODBCResultSet
Private writeQry As ODBCQuery
Private writeRS As ODBCResultSet
Private readQry As ODBCQuery
Private readRS As ODBCResultSet

Sub InitCon
'Initialize ODBC Connection Objects
Set Con = Connect()
'Used for Select SQL statements
Set readQry = New ODBCQuery
Set readRS = New ODBCResultSet
Set readQry.Connection = con
Set readRS.Query = readQry
'Used for INSERTS, UPDATES, DELETEs SQL statements
Set writeQry = New ODBCQuery
Set writeRS = New ODBCResultSet
Set writeQry.Connection = con
Set writeRS.Query = writeQry
'Used for extra querys
Set Qry = New ODBCQuery
Set Res = New ODBCResultSet
Set Qry.Connection = con
Set Res.Query = Qry
End Sub


IN THE SCRIPT LIBRARY:

Function Connect() As ODBCConnection
%REM
Returns: Connection
Purpose: This function creates a connection to the relational model selected. requires
datasource (DS$) username(USER$) and password (PW) ; parmeters stored in Declarations
%END REM
' Define objects
Dim OpenCon As New ODBCConnection
Dim retcode As Integer
Dim errors As Integer
Dim ExtendMsg As String
'Establish Connection
retcode% = OpenCon.ConnectTo(DS$, USER$,PW$)
OpenCon.AutoCommit = False
OpenCon.CommitOnDisconnect = False
OpenCon.SilentMode = True 'this is to stop a connection dialog box from mysteriously appearing
'Error Handling
If (retcode% = False) Then
errors% = OpenCon.GetError
ExtendMsg$ = OpenCon.GetExtendedErrorMessage(errors%)
Exit Function
End If
'Return Connection object to agent that called function
Set Connect = OpenCon
End Function

(Declarations)
Private Const DS$ = "*Local"
Private Const USER$ = "my_userid_goes_here"
Private Const PW$ = "my_password_goes_here"




ODBC Connection to Oracle (~Yoshi Quetkist... 15.Oct.03)
. . RE: ODBC Connection to Oracle (~Bella Deswevit... 15.Oct.03)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS